package com.lagou.decoder;

import com.lagou.serializer.Serializer;
import io.netty.buffer.ByteBuf;
import io.netty.channel.ChannelHandlerContext;
import io.netty.handler.codec.MessageToMessageDecoder;

import java.nio.charset.Charset;
import java.util.List;

/**
 * @program: stage_3_module_1
 * @description:
 * @author: zhangxiaoyang
 * @date: 2020-08-18 05:38
 **/
public class RpcDecoder extends MessageToMessageDecoder<ByteBuf> {

    private Class<?> clazz;

    private Serializer serializer;


    public RpcDecoder(Class<?> clazz, Serializer serializer) {
        this.clazz = clazz;
        this.serializer = serializer;

    }

    @Override
    protected void decode(ChannelHandlerContext channelHandlerContext, ByteBuf buf, List<Object> list) {
        list.add(buf.toString(Charset.defaultCharset()));
    }


}
